public class PersonTest {
    public static void main(String[] args) {
        System.out.println("----------正常方法调用-------------");
        Person S = new Person();
        S.setEat();
        System.out.println("--------------------------------");
        SouthPerson southPerson = new SouthPerson();
        southPerson.eat();
        System.out.println("--------------------------------");
        NorthPerson northPerson = new NorthPerson();
        northPerson.eat();


        System.out.println("-----------多态方法调用------------");
        Person A = new SouthPerson();//向上转型
        A.setEat();
        System.out.println("---------------------------------");
        SouthPerson B = (SouthPerson) A;//向下转型
        B.eat();
        System.out.println("---------------------------------");
        Person C = new NorthPerson();
        C.setEat();
        System.out.println("---------------------------------");
        NorthPerson D = (NorthPerson) C;
        D.eat();
    }
}